
<script type="text/javascript" src="<?php echo $theme; ?>/util/jui/jquery-ui-1.7.2.custom.min.js"></script>
<link type="text/css" href="<?php echo $theme; ?>/util/jui/jquery-ui-1.7.2.custom.css" rel="stylesheet" />


<h3>图片：<?php echo $node['node_title']?></h3>

<style type="text/css">
#sortable { list-style-type: none; margin: 0; padding: 0; width: 500px; font-size:13px; }
#sortable li { height:100%; overflow:hidden; margin: 4px auto; }
#sortable li div { float:left; }
#sortable li div.btn{ float:right; }
</style>
<script type="text/javascript">
$(function() {
	$("#sortable").sortable();
	$("#sortable").disableSelection();
	$("#sortable input[ikey]").click(function(){
		if(window.confirm("确认删除此图片？")){
			var pnode	=	this.parentNode.parentNode;
			$.get(
				'<?php echo url('node-img-del/id/'.$node['node_id'].'/key/KEY'); ?>'.replace('KEY', $(this).attr('ikey')),
				function(data){
					if('ok'==data){
						$(pnode).remove();
						alert('删除成功');
					}
					else{
						alert(data);
					}
				}
			);
		}
	});
});
</script>

<ul id="sortable">
<?php if($node['node_img']) foreach($node['node_img'] as $key){ ?>
<li class="ui-state-default">
	<div><span class="ui-icon ui-icon-arrowthick-2-n-s"></span></div>
	<div><img src='<?php echo url_img($key, '121'); ?>'/></div>
	<div class="btn"><input type="button" ikey="<?php echo $key; ?>" value="删除" /></div>
</li>
<?php } ?>
</ul>

<input type="button" value="返回" onclick="location.href='<?php echo url('node')?>'"/>
<input type="button" value="保存顺序" onclick="
	var keys= [];
	$('#sortable input[ikey]').each(function(i,n){
		keys.push($(n).attr('ikey'));
	});
	$.post('<?php echo url('node-img-sort/id/'.$node['node_id']); ?>',
		{'keys':keys.join(':')},
		function(data){alert(data);}
	);
" />
